var t = require("../../../api.js"), e = getApp(), n = require("../../../utils/function.js");

Page({
    data: {
        img: n.userImg,
        page: 1
    },
    onLoad: function(t) {},
    onReady: function() {},
    onShow: function() {
        var n = this;
        e.request({
            url: t.coupon_list.index,
            method: "post",
            data: {},
            success: function(t) {
                n.setData({
                    couponArr: t.data
                });
            }
        });
    },
    receive: function(n) {
        var o = this, a = n.currentTarget.dataset.id, s = n.currentTarget.dataset.money;
        n.target.dataset.pasttime;
        e.request({
            url: t.coupon_list.receive,
            method: "post",
            data: {
                id: a
            },
            success: function(t) {
                1 == t.code ? (wx.showModal({
                    title: "提示",
                    content: "恭喜你获得" + s + "元红包",
                    showCancel: !1
                }), o.onShow()) : wx.showModal({
                    title: "提示",
                    content: t.msg,
                    showCancel: !1
                });
            }
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});